﻿using System;
using System.Text;

namespace RIFF.Chunk
{
    public class FourCC
    {
        private static readonly UTF8Encoding encoding = new UTF8Encoding();

        public byte[] Data { get; }

        public FourCC(byte[] bytes)
        {
            if (bytes.Length != 4)
            {
                throw new ArgumentException($"FourCC 必须为 4 个字节");
            }

            Data = (byte[])bytes.Clone();
        }

        public override string ToString()
        {
            return encoding.GetString(Data);
        }
    }
}
